<!doctype html>
<html class="no-js" lang="">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title>angular-oauth2-oidc</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="icon" type="image/x-icon" href="../images/favicon.ico">
	      <link rel="stylesheet" href="../styles/style.css">
    </head>
    <body>

        <div class="navbar navbar-default navbar-fixed-top visible-xs">
            <a href="../" class="navbar-brand">angular-oauth2-oidc</a>
            <button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
        </div>

        <div class="xs-menu menu" id="mobile-menu">
                <div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div>            <compodoc-menu></compodoc-menu>
        </div>

        <div class="container-fluid main">
           <div class="row main">
               <div class="hidden-xs menu">
                   <compodoc-menu mode="normal"></compodoc-menu>
               </div>
               <!-- START CONTENT -->
               <div class="content additional-page">
                   <div class="content-data">














                   




<h1 id="session-checks">Session Checks</h1>
<p>Beginning with version 2.1, you can receive a notification when the user signs out with the identity provider.
This is implemented as defined by the OpenID Connect Session Management 1.0 spec.</p>
<p>When this option is activated, the library also automatically ends your local session. This means, the current tokens
are deleted by calling <code>logOut</code>. In addition to that, the library sends a session_terminated event, you can register
for to perform a custom action.</p>
<p>Please note that this option can only be used when also the identity provider in question supports it.</p>
<h2 id="configuration">Configuration</h2>
<p>To activate the session checks that leads to the mentioned notifications, set the configuration property
<code>sessionChecksEnabled</code>:</p>
<div><pre class="line-numbers"><code class="language-TypeScript">import { AuthConfig } from &#39;angular-oauth2-oidc&#39;;

export const authConfig: AuthConfig = {
  issuer: &#39;https://steyer-identity-server.azurewebsites.net/identity&#39;,
  redirectUri: window.location.origin + &#39;/index.html&#39;,
  silentRefreshRedirectUri: window.location.origin + &#39;/silent-refresh.html&#39;,
  clientId: &#39;spa-demo&#39;,
  scope: &#39;openid profile email voucher&#39;,

  // Activate Session Checks:
  sessionChecksEnabled: true,
}</code></pre></div><h2 id="refresh">Refresh</h2>
<p>Please note that the lib performs a token refresh when the session changes to get the newest information about the current session. When using implicit flow, this means you have to configure <a href="./silent-refresh.html">silent refresh</a>; when using code flow you either need silent refresh or a <a href="./refreshing-a-token.html">refresh token</a>.</p>
<p>If using refresh tokens, your Auth Server needs to bind them to the current session&#39;s lifetime. Unfortunately, the used version of Identity Server 4, shown in the docs and in the example applications, does not support this at the moment.</p>
<h2 id="events">Events</h2>
<p>To get notified, you can hook up for the event <code>session_terminated</code>:</p>
<div><pre class="line-numbers"><code class="language-TypeScript">this.oauthService.events.pipe(filter(e =&gt; e.type === &#39;session_terminated&#39;)).subscribe(e =&gt; {
  console.debug(&#39;Your session has been terminated!&#39;);
})</code></pre></div>
                   </div><div class="search-results">
    <div class="has-results">
        <h1 class="search-results-title"><span class='search-results-count'></span> result-matching "<span class='search-query'></span>"</h1>
        <ul class="search-results-list"></ul>
    </div>
    <div class="no-results">
        <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
    </div>
</div>
</div>
               <!-- END CONTENT -->
           </div>
       </div>

       <script>
            var COMPODOC_CURRENT_PAGE_DEPTH = 1;
            var COMPODOC_CURRENT_PAGE_CONTEXT = 'additional-page';
            var COMPODOC_CURRENT_PAGE_URL = 'session-checks.html';
            var MAX_SEARCH_RESULTS = 15;
       </script>

       <script src="../js/libs/custom-elements.min.js"></script>
       <script src="../js/libs/lit-html.js"></script>
       <!-- Required to polyfill modern browsers as code is ES5 for IE... -->
       <script src="../js/libs/custom-elements-es5-adapter.js" charset="utf-8" defer></script>
       <script src="../js/menu-wc.js" defer></script>

       <script src="../js/libs/bootstrap-native.js"></script>

       <script src="../js/libs/es6-shim.min.js"></script>
       <script src="../js/libs/EventDispatcher.js"></script>
       <script src="../js/libs/promise.min.js"></script>
       <script src="../js/libs/zepto.min.js"></script>

       <script src="../js/compodoc.js"></script>

       <script src="../js/tabs.js"></script>
       <script src="../js/menu.js"></script>
       <script src="../js/libs/clipboard.min.js"></script>
       <script src="../js/libs/prism.js"></script>
       <script src="../js/sourceCode.js"></script>
          <script src="../js/search/search.js"></script>
          <script src="../js/search/lunr.min.js"></script>
          <script src="../js/search/search-lunr.js"></script>
          <script src="../js/search/search_index.js"></script>
       <script src="../js/lazy-load-graphs.js"></script>


    </body>
</html>
